"""
@File    :   out.py
@Time    :   2024/03/25 10:44:30
@Author  :   Qrj
@Email   :   923207736@qq.com
@description   :   租户相关的pydantic序列化模型
"""

from datetime import datetime

from pydantic import BaseModel, Field, TypeAdapter

from src.schemas.out import BaseOutSchemaConfigMixin


class TenantCompleteOutSchema(BaseModel, BaseOutSchemaConfigMixin):
    """租户完整的序列化模型"""

    id: int = Field(default=..., description="主键")
    is_system: bool = Field(default=..., description="是否系统级别租户")
    status: bool = Field(default=..., description="状态")
    show_order: int = Field(default=..., description="显示顺序")
    remark: str = Field(default=..., description="备注")
    create_datetime: datetime = Field(default=..., description="创建时间")
    update_datetime: datetime = Field(default=..., description="修改时间")
    expiration_datetime: datetime = Field(default=..., description="过期时间")
    creator_username: str = Field(default=..., description="创建者")
    updater_username: str = Field(default=..., description="修改者")
    admin_user_id: int = Field(default=..., description="管理员用户ID")
    admin_username: str = Field(default=..., description="管理员用户名")
    name: str = Field(default=..., description="租户名")
    bind_domain: str = Field(default=..., description="绑定域名")
    quota: int = Field(default=..., description="额度")
    tenant_package_id: int = Field(default=..., description="租户套餐ID")
    tenant_package_name: str = Field(default=..., description="租户套餐名称")


# 完整的租户列表序列化模型
ListTenantCompleteOutSchema = TypeAdapter(list[TenantCompleteOutSchema])


class TenantLoginPageSelectOutSchema(BaseModel, BaseOutSchemaConfigMixin):
    """登录页面选择租户使用的序列化模型"""

    id: int = Field(default=..., description="主键")
    name: str = Field(default=..., description="租户名")
    bind_domain: str = Field(default=..., description="绑定域名")


# 登录页面选择租户使用的列表序列化模型
ListTenantLoginPageSelectOutSchema = TypeAdapter(list[TenantLoginPageSelectOutSchema])
